clc
clear all
motor_on_data = xlsread('Board Only Data.xls','z constant');
for i = 1:length(motor_on_data(:,1));
    rho(i,1) = ((motor_on_data(i,1)^2)+(motor_on_data(i,2)^2))^(1/2);
    theta(i,1) = (atan((motor_on_data(i,2))/(motor_on_data(i,1))));
    if motor_on_data(i,1) >= 0 & motor_on_data(i,2) >= 0
        theta(i,1) = theta(i,1);
    end
    if motor_on_data(i,1) < 0 & motor_on_data(i,2) >= 0
        theta(i,1) = pi + theta(i,1);
    end
    if motor_on_data(i,1) < 0 & motor_on_data(i,2) < 0
        theta(i,1) = pi + theta(i,1);
    end
    if motor_on_data(i,1) >= 0 & motor_on_data(i,2) < 0
        theta(i,1) = 2*pi + theta(i,1);
    end
end

figure
polar(theta(:,1),rho(:,1),'.');
title('Board Only Constant Z')

motor_on_data = xlsread('motor on data.xls');
for i = 1:length(motor_on_data(:,1));
    rho(i,1) = ((motor_on_data(i,1)^2)+(motor_on_data(i,2)^2))^(1/2);
    theta(i,1) = (atan((motor_on_data(i,2))/(motor_on_data(i,1))));
    if motor_on_data(i,1) >= 0 & motor_on_data(i,2) >= 0
        theta(i,1) = theta(i,1);
    end
    if motor_on_data(i,1) < 0 & motor_on_data(i,2) >= 0
        theta(i,1) = pi + theta(i,1);
    end
    if motor_on_data(i,1) < 0 & motor_on_data(i,2) < 0
        theta(i,1) = pi + theta(i,1);
    end
    if motor_on_data(i,1) >= 0 & motor_on_data(i,2) < 0
        theta(i,1) = 2*pi + theta(i,1);
    end
end
figure
polar(theta(:,1),rho(:,1),'.k');
title('Motors Not Running Constant Z')

motor_on_data = xlsread('motor not on data.xls');
for i = 1:length(motor_on_data(:,1));
    rho(i,1) = ((motor_on_data(i,1)^2)+(motor_on_data(i,2)^2))^(1/2);
    theta(i,1) = (atan((motor_on_data(i,2))/(motor_on_data(i,1))));
    if motor_on_data(i,1) >= 0 & motor_on_data(i,2) >= 0
        theta(i,1) = theta(i,1);
    end
    if motor_on_data(i,1) < 0 & motor_on_data(i,2) >= 0
        theta(i,1) = pi + theta(i,1);
    end
    if motor_on_data(i,1) < 0 & motor_on_data(i,2) < 0
        theta(i,1) = pi + theta(i,1);
    end
    if motor_on_data(i,1) >= 0 & motor_on_data(i,2) < 0
        theta(i,1) = 2*pi + theta(i,1);
    end
end
figure
polar(theta(:,1),rho(:,1),'.g');
title('Motors Running Constant Z')

